<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<title>阳光灿然CRM</title>
	<script src="//cdn.bootcss.com/jquery/1.11.0/jquery.min.js"></script>
	<link rel="stylesheet" href="/js/frame/layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="/js/frame/font-awesome/css/font-awesome.min.css" media="all" />
	<link rel="stylesheet" href="/css/frame/app.css" media="all" />
	<link rel="stylesheet" href="/css/frame/themes/orange.css" media="all" id="skin" kit-skin />
	<script src="js/plugin/jquery.i18n/jquery.i18n.properties-1.0.9.js"></script>
	<link rel="shortcut icon" href="static/favicon.ico" />

	<script>
		var languge = '${languge}';
        jQuery.i18n.properties({//加载资浏览器语言对应的资源文件
            name:'language', //资源文件名称
            path:'js/plugin/jquery.i18n/', //资源文件路径
            mode:'map', //用Map的方式使用资源文件中的值
            language:languge,
            callback: function() {//加载成功后设置显示内容

            }
        });
        $(function () {
            $("[i18n-html]").each(function () {
                var $this = $(this);
                $this.html($.i18n.prop($this.attr("i18n-html")));
            });
            // i18n-html="title"
        });
	</script>


</head>

<body class="kit-theme">
<div class="layui-layout layui-layout-admin kit-layout-admin">
	<div class="layui-header">
		<div class="layui-logo" i18n-html="站点标题"></div>
		<div class="layui-logo kit-logo-mobile">E</div>
		<ul class="layui-nav layui-layout-left kit-nav" id="menuTop">
			<!--
			<li class="layui-nav-item"><a href="javascript:;">控制台</a></li>
			<li class="layui-nav-item">
				<a href="javascript:;">其它系统</a>
				<dl class="layui-nav-child">
					<dd><a href="javascript:;">邮件管理</a></dd>
					<dd><a href="javascript:;">消息管理</a></dd>
					<dd><a href="javascript:;">授权管理</a></dd>
				</dl>
			</li>-->
		</ul>
		<ul class="layui-nav layui-layout-right kit-nav">
			<li class="layui-nav-item" style="display: none">
				<a href="javascript:;">
					<i class="layui-icon">&#xe63f;</i> 皮肤</a>
				</a>
				<dl class="layui-nav-child skin">
					<dd><a href="javascript:;" data-skin="default" style="color:#393D49;"><i class="layui-icon">&#xe658;</i> 默认</a></dd>
					<dd><a href="javascript:;" data-skin="orange" style="color:#ff6700;"><i class="layui-icon">&#xe658;</i> 橘子橙</a></dd>
					<dd><a href="javascript:;" data-skin="green" style="color:#00a65a;"><i class="layui-icon">&#xe658;</i> 原谅绿</a></dd>
					<dd><a href="javascript:;" data-skin="pink" style="color:#FA6086;"><i class="layui-icon">&#xe658;</i> 少女粉</a></dd>
					<dd><a href="javascript:;" data-skin="blue" style="color:#00c0ef;"><i class="layui-icon">&#xe658;</i> 天空蓝</a></dd>
					<dd><a href="javascript:;" data-skin="red" style="color:#dd4b39;"><i class="layui-icon">&#xe658;</i> 枫叶红</a></dd>
				</dl>
			</li>
			<li class="layui-nav-item">
				<a href="javascript:;">
					<img src="http://m.zhengjinfan.cn/images/0.jpg" class="layui-nav-img"> ${name}
				</a>
				<dl class="layui-nav-child">
					<dd><a onclick="baseInfo(this)"><span i18n-html="基本资料"></span></a></dd>
				</dl>
			</li>
			<script>
				function baseInfo(dom) {
                    tabAdd($(dom).find('span').html(),"/system/product/base")
                }
			</script>
			<li class="layui-nav-item"><a href="/logout"><i class="fa fa-sign-out" aria-hidden="true"></i><span i18n-html="注销"></span></a></li>
		</ul>
	</div>

	<div class="layui-side layui-bg-black kit-side" >
		<div class="layui-side-scroll">
			<div class="kit-side-fold"><i class="fa fa-navicon" aria-hidden="true" id="topMenuName"></i></div>
			<ul class="layui-nav layui-nav-tree"  id="menu">

			</ul>
<!--
			<ul class="layui-nav layui-nav-tree" >
				<li data-name="home" class="layui-nav-item layui-nav-itemed"><a href="javascript:;"><i class="layui-icon layui-icon-home"></i><cite>预约会议</cite><span class="layui-nav-more"></span></a>
					<dl class="layui-nav-child">
						<dd data-name="console" class="">
							<a href="javascript:;" onclick="clickMenu(this)" data-url="/reservationlist" data-id="搜索">搜索</a>
						</dd>
						<dd data-name="console" class="">
							<a href="javascript:;" >预约会议</a>
							<dl class="layui-nav-child">
								<dd><a href="#">预约会议1</a></dd>
								<dd><a href="#">预约会议2</a></dd>
								<dd><a href="#">预约会议3</a></dd>
							</dl>
						</dd>
					</dl></li>
				<li data-name="home" class="layui-nav-item layui-nav-itemed"><a href="javascript:;"><i class="layui-icon layui-icon-home"></i><cite>控制管理</cite><span class="layui-nav-more"></span></a>
					<dl class="layui-nav-child">
						<dd data-name="console" class="">
							<a href="javascript:;" onclick="clickMenu(this)" data-url="/static/20180605HTML/control.html?v=1" data-id="会议室控制">会议室控制</a>
						</dd>
					</dl></li>
				<li data-name="home" class="layui-nav-item layui-nav-itemed "><a href="javascript:;" onclick="clickMenu(this)" data-url="/static/20180605HTML/state.html?v=1001" data-id="运营管理"><i class="layui-icon layui-icon-home"></i><cite>运营管理</cite></a></li>
				<li data-name="home" class="layui-nav-item  "><a href="javascript:;" onclick="clickMenu(this)" data-url="/static/20180605HTML/count_daily.html?v=1" data-id="统计报表"><i class="layui-icon layui-icon-home"></i><cite>统计报表</cite></a></li>
				<li data-name="home" class="layui-nav-item  "><a href="javascript:;" onclick="clickMenu(this)" data-url="/static/20180605HTML/query.html?v=1" data-id="查询"><i class="layui-icon layui-icon-home"></i><cite>查询</cite></a></li>
				<li data-name="home" class="layui-nav-item  "><a href="javascript:;" onclick="clickMenu(this)" data-url="/user" data-id="用户管理"><i class="layui-icon layui-icon-home"></i><cite>用户管理</cite></a></li>
				<span class="layui-nav-bar" style="height: 0px; top: 148px; opacity: 0;"></span>
			</ul>

-->

			<!--
			<ul class="layui-nav layui-nav-tree" id="menu">

			</ul>-->
			<!-- 左侧导航区域（可配合layui已有的垂直导航） -->
			<!--
               <li data-name="home" class="layui-nav-item"><a href="javascript:;"><i class="layui-icon layui-icon-home"></i><cite>主页</cite>

               <span class="layui-nav-more"></span></a><dl class="layui-nav-child">
                       <dd data-name="console" class=""><a lay-href="home/console.html">控制台</a></dd>
               </dl>
               </li>-->

			<!--
                            <ul class="layui-nav layui-nav-tree" lay-filter="kitNavbar" kit-navbar id="menu">

                            <li class="layui-nav-item">
                                <a class="" href="javascript:;"><i class="fa fa-plug" aria-hidden="true"></i><span>商品管理</span></a>
                                <dl class="layui-nav-child">
                                    <dd>
                                        <a href="javascript:;" kit-target data-options="{url:'/product/kecheng',icon:'&#xe6c6;',title:'课程管理',id:'202'}"><i class="layui-icon">&#xe6c6;</i><span> 课程管理</span></a>
                                    </dd>
                                    <dd><a href="javascript:;" kit-target data-options="{url:'/product/category',icon:'&#xe6c6;',title:'分类管理',id:'222'}"><i class="layui-icon">&#xe6c6;</i><span> 课程管理</span></a></dd>
                                </dl>
                            </li>

                            <li class="layui-nav-item">
                                <a class="" href="javascript:;"><i class="fa fa-plug" aria-hidden="true"></i><span> 系统设置</span></a>
                                <dl class="layui-nav-child">
                                    <dd><a href="javascript:;" kit-target data-options="{url:'/system/user',icon:'&#xe6c6;',title:'用户管理',id:'901'}"><i class="layui-icon">&#xe6c6;</i><span> 管理用户</span></a></dd>
                                    <dd><a href="javascript:;" kit-target data-options="{url:'/system/role',icon:'&#xe6c6;',title:'角色管理',id:'902'}"><i class="layui-icon">&#xe6c6;</i><span> 角色管理</span></a></dd>
                                    <dd><a href="javascript:;" kit-target data-options="{url:'/system/permission',icon:'&#xe6c6;',title:'权限管理',id:'903'}"><i class="layui-icon">&#xe6c6;</i><span> 权限管理</span></a></dd>
                                </dl>
                            </li>

			</ul>
			-->

		</div>
	</div>
	<div class="layui-body" id="container">
		<!-- 内容主体区域 -->
		<div style="padding: 15px;"><i class="layui-icon layui-anim layui-anim-rotate layui-anim-loop">&#xe63e;</i> 请稍等...</div>
	</div>


	<div class="layui-footer">
		<!-- 底部固定区域 -->
		2018 &copy;
		<a>www.sunshinehome.com.cn</a>
	</div>
</div>
<script src="js/frame/layui/layui.js"></script>

<script>
    var message;
    var navbar ;
    var onelevel;
    var element ;
    layui.config({
        base: 'js/frame/',
        version: '1.0.1'
    }).use(['app', 'message','navbar','onelevel','element'], function() {
        var app = layui.app,
            $ = layui.jquery,
            layer = layui.layer;
        //将message设置为全局以便子页面调用
        message = layui.message;
		navbar = layui.navbar;
        onelevel = layui.onelevel;
        element = layui.element;




        //主入口
        app.set({
            type: 'iframe'
        }).init();
        $('#pay').on('click', function() {
            layer.open({
                title: false,
                type: 1,
                content: '<img src="/src/images/pay.png" />',
                area: ['500px', '250px'],
                shadeClose: true
            });
        });
        $('dl.skin > dd').on('click', function() {
            var $that = $(this);
            var skin = $that.children('a').data('skin');
            switchSkin(skin);
        });
        var setSkin = function(value) {
                layui.data('kit_skin', {
                    key: 'skin',
                    value: value
                });
            },
            getSkinName = function() {
                return layui.data('kit_skin').skin;
            },
            switchSkin = function(value) {
                var _target = $('link[kit-skin]')[0];
                _target.href = _target.href.substring(0, _target.href.lastIndexOf('/') + 1) + value + _target.href.substring(_target.href.lastIndexOf('.'));
                setSkin(value);
            },
            initSkin = function() {
                var skin = getSkinName();
                switchSkin('orange');
                //switchSkin(skin == undefined ? 'orange' : skin);
            }();



        var meanuTopHtml = "";
        for(var key in menu){
            var row = menu[key];
            if(languge=="en"){
                row.name = row.enName;
            }
            menuTopData[row.name] = row;
            var name = "";

            meanuTopHtml += '<li class="layui-nav-item" onclick=menuTop("'+row.name+'")><a href="javascript:;"  style="font-size: 18px;">'+row.name+'</a></li>';
        }
        $('#menuTop').html(meanuTopHtml);
		$('#menuTop li').get(0).click()
    });

    /*
    var menu = [
        {
            name:"商品系统",
            children:[
                {
                    name:"商品系统管理",
                    children:[
                        {
                            name:"商品类目管理",
                            url:"/product/category"
                        },
                        {
                            name:"商品属性名分组管理",
                            url:"/product/attr/group"
                        },
                        {
                            name:"商品属性名管理",
                            url:"/product/attr"
                        },
                        {
                            name:"商品属性值管理",
                            url:"/product/attr/all"
                        },
                        {
                            name:"商品类目属性设置",
                            url:"/product/category/category-attrgroup-attr-value"
                        },
                        {
                            name:"商品管理",
                            url:"/product/all"
                        },
						{
                        	name:"测试",
							children:[
								{
								    name:"测试1"
								},
                                {
                                    name:"测试1"
                                }
							]
						}
                    ]
                }

            ]
        },{
            name:"市场销售",
            children:[
                {
                    name:"客户管理",
                    children:[
                        {
                            name:"客户资料管理"
                        },
                        {
                            name:"客户跟进管理"
                        }
                    ]
                },
                {
                    name:"营销管理",
                    children:[
                        {
                            name:"市场活动管理"
                        },
                        {
                            name:"渠道指标导入"
                        },
						{
                            name:"市场投入转换分析"
                        }
                    ]
                }
            ]
        },
		{
            name:"管理员控制台",
            children:[
                {
                    name:"管理用户",
					url:'/system/user'
                },
                {
                    name:"角色管理",
                    url:'/system/role'
                },
                {
                    name:"权限管理",
                    url:'/system/permission'
                },{
                    name:"组织机构",
                    url:'/system/permission'
                },{
                    name:"系统模块管理",
                    url:'/system/menu'
                }
            ]
		}
    ];*/

    var menu = null;
	$.ajax({
        type: "get",
        url: "/system/menu/tree",
		async:false,
        dataType: "json",
        success: function (res) {
            menu = res.data;
        }
	});

    var menuTopData = {};
    function menuTop(topName) {
		var html = "";
		var top = menuTopData[topName];
		$('#topMenuName').html(topName);
		for(var i = 0;i< top.children.length;i++){
		    var row = top.children[i];
		    if(languge=="en"){
		        row.name = row.enName;
			}
		    html += '<li data-name="home" class="layui-nav-item ';
		    if(row.opend==1){
		        html += 'layui-nav-itemed';
			}
		    html +=' "><a href="javascript:;" ' ;

		    if(row.url!=null&& row.url!=""){
                html += 'onclick="clickMenu(this)" data-url="'+row.url+'" data-id="'+row.name+'"';
            }
			html += '><i class="layui-icon layui-icon-home"></i><cite>'+row.name+'</cite>';

			if(row.children!=null){
			    html += '<span class="layui-nav-more"></span></a>';
		        html += '<dl class="layui-nav-child">';
                for(var j = 0;j<row.children.length;j++){
                    var menu = row.children[j];
                    if(languge=="en"){
                        menu.name = menu.enName;
                    }
                    html += '<dd data-name="console" class="">';
                    var onclick = (menu.url!=null?'onclick="clickMenu(this)"':"");
					html += '<a href="javascript:;"  '+onclick+' data-url="'+menu.url+'" data-id="'+menu.name+'" >'+menu.name+'</a>' ;
					if(menu.children!=null){
					    html += '<dl class="layui-nav-child">';
					    for(var k = 0;k<menu.children.length;k++){
					        var three = menu.children[k];
					        html += '<dd>'+'<a href="javascript:;"  '+(three.url!=null?'onclick="clickMenu(this)"':"")+' data-url="'+three.url+'" data-id="'+three.name+'" >'+three.name+'</a>'+'</dd>' ;
						}
						html += '</dl>';
					}
					html += '</dd>';

                }
				html += '</dl>';
			}else{
                html += '</a>';
			}


			html += '</li>';
		};
		$('#menu').html(html);
        element.init();
    }
    function clickMenu(dom) {
        tabAdd($(dom).data('id'),'${base}/'+$(dom).data('url'))
    }
    function tabAdd(name,url) {
        layui.tab.tabAdd({
            icon:'fa-product',
            id:name,
            title:name,
            url:url
        });
    }
    function showPic(url) {
         window.open(url);
    }
</script>
</body>

</html>